package com.worldcup.utils;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;

import java.io.File;

/**
 * @author duwan.zq
 * @date 2018/06/13
 */
public class OssUtils {

    private static final String bucketname = "worldcuptemp";

    private OSSClient ossClient;

    private static OssUtils ossUtils;

    private OssUtils(OSSClient ossClient){
        this.ossClient = ossClient;
    }

    public static OssUtils getOssClient(){
        if(ossUtils == null){
            OSSClient ossClient = new OSSClient("oss-cn-beijing.aliyuncs.com", "LTAIv4prXZw4ElHB", "POaKwz4kFzpFxfnfbBbU2xAILJ8APg");
            ossUtils = new OssUtils(ossClient);
        }
        return ossUtils;
    }


    public void upload(String fileKey, File file2put){
        ossClient.putObject(bucketname, fileKey, file2put);
    }

}
